<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>iMK-ical</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.default.css" id="theme-stylesheet">
    <link id="new-stylesheet" rel="stylesheet">
    <link rel="icon" href="../index/imc.png">
    <script type="text/javascript" src=".././js/config.js"></script>
    <script type="text/javascript"  src=".././js/jquery-1.4.js"></script>
    <script src=".././js/jquery.js"></script>
    <script type="text/javascript" src=".././js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/jquery.validate.min.js"></script><!--表单验证-->
</head>
<body style="">
<div class="page login-page">
    <div class="container d-flex align-items-center">
        <div class="form-holder has-shadow">
            <div class="row">
                <!-- Logo & Information Panel-->
                <div class="col-lg-6">
                    <div class="info d-flex align-items-center">
                        <div class="content">
                            <div class="logo">
                                <h1>ical日历课程</h1>
                                <h2 id="total">日程生成总数：</h2>
                            </div>
                            <p>
                                【ics是个什么?】：ics文件是日历的一种常见文件格式,可以将日程事件导入日历。生成学生课程ics,导入日历将会生成一个日历课程表，不需要其他应用支持，手机原装日历软件轻松搞定，还会提前十分钟上课小弹窗提醒哟！<br>
                                【ics适用平台?】：Android、iOS、PC<br>
                                【ics怎么生成?】：在此页面登录[信息门户]账号，系统自动生成课程ics文件,并以邮件附件方式发送到邮箱。<br>
                                【ics导入安卓?】：👉<a href="androidics.html">导入教程</a><br>
                                【ics导入苹果?】：👉<a href="iosics.html">导入教程</a><br>
                            </p>
                            <p>By:微信公众号i麦壳功能支持（iMK-CSLG助手），欢迎关注🙂！</p>
                        </div>
                    </div>
                </div>
                <!-- Form Panel    -->
                <div class="col-lg-6 bg-white">
                    <div class="form d-flex align-items-center">
                        <div class="content">
                            <div class="logo">
                                <h1>信息门户</h1>
                            </div>
                            <form method="post" action="" class="form-validate" id="loginFrom" novalidate="novalidate">
                                <div class="form-group">
                                    <input id="login-username" type="text" name="userName" required="" data-msg="请输入学号"
                                           placeholder="请输入学号" value="" class="input-material">
                                </div>
                                <div class="form-group">
                                    <input id="login-password" type="password" name="passWord" required=""
                                           data-msg="请输入信息门户密码" placeholder="请输入信息门户密码" class="input-material">
                                </div>
                                <div class="form-group">
                                    <input id="login-email" type="text" name="email" required=""
                                           data-msg="请输入联系邮箱，生成文件将会以邮件方式发送"
                                           placeholder="请输入联系邮箱,生成文件将会发送到该邮箱" value="" class="input-material">
                                </div>

                            </form>
                            <div id="loadingDiv" style="display:none">
                                <div class="loading">
                                    <span></span>
                                    <span></span>
                                    <span></span>
                                    <span></span>
                                </div>
                            </div>

                            <button id="login" type="submit" onClick="return login()" class="btn btn-primary">登录
                            </button>
                            <br>
                            <small>信息门户具体是哪个❓</small><a
                                href="https://webvpn.cslg.edu.cn/https/77726476706e69737468656265737421f3f652d224236457300d8db9d6562d/cas/login"
                                class="signup">&nbsp;去看看（ps：记得回来登录哟！）</a>
                            <br>
                            <small>信息门户密码忘记了❓</small><a
                                href="xxmhhelp.html"
                                class="signup">&nbsp;去重置</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<script language="javascript">

    function login() {
        var baseUrl = config.urlConfig.url;
        var userName = $("#login-username").val();
        var passWord = $("#login-password").val();
        var email = $("#login-email").val();
        var reMe = 0;
        var check1 = $("#check1").prop('checked');
        if (check1 === true) reMe = 1;
        console.log(userName);
        if (userName.length !== 9) alert("学号为九位");
        else if (passWord.length < 6) alert("密码至少为6位")
        else {
            var winNode = $("#loadingDiv");
            winNode.fadeIn("slow");

            var loginNode = $("#login");
            loginNode.hide();

            var form = new FormData();
            form.append("sno", userName);
            form.append("password", passWord);
            form.append("remberMe", reMe);
            form.append("email", email);

            var settings = {
                "url": baseUrl + "/cslg/xxmh/ical",
                "method": "POST",
                "timeout": 50000,
                "processData": false,
                "mimeType": "multipart/form-data",
                "contentType": false,
                "data": form
            };

            $.ajax(settings).done(function (response) {
                var json=JSON.parse(response)
                var Node = $("#loadingDiv");
                Node.hide();
                var loginNode = $("#login");
                loginNode.fadeIn("slow");
                if (json.result === true) {
                    alert(json.info);
                    window.location.href = "./help/";
                } else {
                    alert(json.resultMsg);
                }
            });


        }
    }

</script>

<script>
    var baseUrl = config.urlConfig.url;
    var settings = {
        "url": baseUrl + "/cslg/app/icalTotal",
        "method": "GET",
        "timeout": 50000,
    };
    $.ajax(settings).done(function (response) {
        console.log(response);
        if (response.result === true) {
            $("#total").append(response.total);
        }
    });
</script>


<style type="text/css">
    * {
        padding: 0;
        margin: 0;
    }

    .loading {
        height: 40px;
        margin: 100px auto;
        display: flex;
        justify-content: center;
    }

    .loading span {
        width: 8px;
        height: 20%;
        border-radius: 4px;
        background-color: lightgreen;
        animation: load 1s ease infinite;
        margin: 0 2px;
    }

    @keyframes load {
        0%,
        100% {
            transform: scaleY(1.5);
            background-color: lightgreen;
        }
        50% {
            transform: scaleY(1);
            background-color: lightblue;
        }
    }

    .loading span:nth-child(2) {
        animation-delay: 0.2s;
    }

    .loading span:nth-child(3) {
        animation-delay: 0.4s;
    }

    .loading span:nth-child(4) {
        animation-delay: 0.6s;
    }

    .loading span:nth-child(5) {
        animation-delay: 0.8s;
    }

</style>
</html>